<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>TMFFMethod</title>
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="TMFFMethod";
    }
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!--   -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-all.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../mmj/tmff/TMFFFormat.html" title="class in mmj.tmff"><span class="strong">Prev Class</span></a></li>
<li><a href="../../mmj/tmff/TMFFPreferences.html" title="class in mmj.tmff"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?mmj/tmff/TMFFMethod.html" target="_top">Frames</a></li>
<li><a href="TMFFMethod.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">mmj.tmff</div>
<h2 title="Class TMFFMethod" class="title">Class TMFFMethod</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>mmj.tmff.TMFFMethod</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><a href="../../mmj/tmff/TMFFAlignColumn.html" title="class in mmj.tmff">TMFFAlignColumn</a>, <a href="../../mmj/tmff/TMFFFlat.html" title="class in mmj.tmff">TMFFFlat</a>, <a href="../../mmj/tmff/TMFFTwoColumnAlignment.html" title="class in mmj.tmff">TMFFTwoColumnAlignment</a>, <a href="../../mmj/tmff/TMFFUnformatted.html" title="class in mmj.tmff">TMFFUnformatted</a></dd>
</dl>
<hr>
<br>
<pre>public abstract class <span class="strong">TMFFMethod</span>
extends java.lang.Object</pre>
<div class="block">TMFFMethod is the base class for text mode formula formatting (TMFF) methods.
 It is designed to be fully reentrant and suitable for use with global
 (default) formatting using a single Method, or at the Syntax Axiom / VarHyp
 level of an individual ParseNode.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!--   -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected int</code></td>
<td class="colLast"><code><strong><a href="../../mmj/tmff/TMFFMethod.html#maxDepth">maxDepth</a></strong></code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!--   -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../mmj/tmff/TMFFMethod.html#TMFFMethod()">TMFFMethod</a></strong>()</code>
<div class="block">Default constructor.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../mmj/tmff/TMFFMethod.html#TMFFMethod(int)">TMFFMethod</a></strong>(int&nbsp;maxDepth)</code>
<div class="block">Standard constructor for TMFFMethod.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../mmj/tmff/TMFFMethod.html#TMFFMethod(java.lang.String)">TMFFMethod</a></strong>(java.lang.String&nbsp;maxDepthString)</code>
<div class="block">Constructor for TMFFMethod using user parameters.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../mmj/tmff/TMFFMethod.html" title="class in mmj.tmff">TMFFMethod</a></code></td>
<td class="colLast"><code><strong><a href="../../mmj/tmff/TMFFMethod.html#ConstructMethodWithUserParams(java.lang.String[])">ConstructMethodWithUserParams</a></strong>(java.lang.String[]&nbsp;param)</code>
<div class="block">A crude TMFFMethod factory used to construct a TMFFMethod using BatchMMJ2
 RunParm values from the TMFFDefineScheme command.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../mmj/tmff/TMFFMethod.html#renderFormula(mmj.tmff.TMFFStateParams, mmj.lang.ParseTree, mmj.lang.Formula)">renderFormula</a></strong>(<a href="../../mmj/tmff/TMFFStateParams.html" title="class in mmj.tmff">TMFFStateParams</a>&nbsp;tmffSP,
             <a href="../../mmj/lang/ParseTree.html" title="class in mmj.lang">ParseTree</a>&nbsp;parseTree,
             <a href="../../mmj/lang/Formula.html" title="class in mmj.lang">Formula</a>&nbsp;formula)</code>
<div class="block">Formats a formula and outputs it to a StringBuilder using the given
 ParseTree root node and initial Constant of the formula.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected int</code></td>
<td class="colLast"><code><strong><a href="../../mmj/tmff/TMFFMethod.html#renderSubExpr(mmj.tmff.TMFFStateParams, mmj.lang.ParseNode, int)">renderSubExpr</a></strong>(<a href="../../mmj/tmff/TMFFStateParams.html" title="class in mmj.tmff">TMFFStateParams</a>&nbsp;tmffSP,
             <a href="../../mmj/lang/ParseNode.html" title="class in mmj.lang">ParseNode</a>&nbsp;currNode,
             int&nbsp;leftmostColNbr)</code>
<div class="block">Renders a sub-expression by first attempting to output on the current
 line within the maxDepth restriction; if that is not possible then it
 makes a polymorphic call to render the sub-expression using line breaks.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected abstract int</code></td>
<td class="colLast"><code><strong><a href="../../mmj/tmff/TMFFMethod.html#renderSubExprWithBreaks(mmj.tmff.TMFFStateParams, mmj.lang.ParseNode, int)">renderSubExprWithBreaks</a></strong>(<a href="../../mmj/tmff/TMFFStateParams.html" title="class in mmj.tmff">TMFFStateParams</a>&nbsp;tmffSP,
                       <a href="../../mmj/lang/ParseNode.html" title="class in mmj.lang">ParseNode</a>&nbsp;currNode,
                       int&nbsp;leftmostColNbr)</code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>abstract boolean</code></td>
<td class="colLast"><code><strong><a href="../../mmj/tmff/TMFFMethod.html#updateMaxDepth(int)">updateMaxDepth</a></strong>(int&nbsp;maxDepth)</code>
<div class="block">Updates maxDepth for a TMFFMethod if the Method allows updates.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../mmj/tmff/TMFFMethod.html#validateMaxDepth(int)">validateMaxDepth</a></strong>(int&nbsp;maxDepth)</code>
<div class="block">Validates the maxDepth parameter.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../mmj/tmff/TMFFMethod.html#validateMaxDepth(java.lang.String)">validateMaxDepth</a></strong>(java.lang.String&nbsp;maxDepthString)</code>
<div class="block">Validates the maxDepth parameter.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!--   -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!--   -->
</a>
<h3>Field Detail</h3>
<a name="maxDepth">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>maxDepth</h4>
<pre>protected&nbsp;int maxDepth</pre>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!--   -->
</a>
<h3>Constructor Detail</h3>
<a name="TMFFMethod()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>TMFFMethod</h4>
<pre>public&nbsp;TMFFMethod()</pre>
<div class="block">Default constructor.</div>
</li>
</ul>
<a name="TMFFMethod(java.lang.String)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>TMFFMethod</h4>
<pre>public&nbsp;TMFFMethod(java.lang.String&nbsp;maxDepthString)</pre>
<div class="block">Constructor for TMFFMethod using user parameters.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>maxDepthString</code> - maximum sub-tree depth for a sub-expression that
            will not trigger a line-break, not counting leaf nodes, and
            non-Notation Syntax Axioms such as Type Conversions.</dd></dl>
</li>
</ul>
<a name="TMFFMethod(int)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>TMFFMethod</h4>
<pre>public&nbsp;TMFFMethod(int&nbsp;maxDepth)</pre>
<div class="block">Standard constructor for TMFFMethod.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>maxDepth</code> - maximum sub-tree depth for a sub-expression that will not
            trigger a line-break, not counting leaf nodes, and
            non-Notation Syntax Axioms such as Type Conversions.</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a name="renderSubExprWithBreaks(mmj.tmff.TMFFStateParams, mmj.lang.ParseNode, int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>renderSubExprWithBreaks</h4>
<pre>protected abstract&nbsp;int&nbsp;renderSubExprWithBreaks(<a href="../../mmj/tmff/TMFFStateParams.html" title="class in mmj.tmff">TMFFStateParams</a>&nbsp;tmffSP,
                          <a href="../../mmj/lang/ParseNode.html" title="class in mmj.lang">ParseNode</a>&nbsp;currNode,
                          int&nbsp;leftmostColNbr)</pre>
</li>
</ul>
<a name="updateMaxDepth(int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>updateMaxDepth</h4>
<pre>public abstract&nbsp;boolean&nbsp;updateMaxDepth(int&nbsp;maxDepth)</pre>
<div class="block">Updates maxDepth for a TMFFMethod if the Method allows updates.
 <p>
 As of the initial release, only TMFFAlignColumn uses maxDepth. The
 methods TMFFFlat and TMFFUnformatted have maxDepth = Integer.MAX_VALUE
 which results in no maxDepth line breaks from happening -- therefore,
 they do not allow updates after initial construction of the method.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>maxDepth</code> - parameter.</dd>
<dt><span class="strong">Returns:</span></dt><dd>boolean - true only if update performed.</dd></dl>
</li>
</ul>
<a name="validateMaxDepth(int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>validateMaxDepth</h4>
<pre>public static&nbsp;int&nbsp;validateMaxDepth(int&nbsp;maxDepth)</pre>
<div class="block">Validates the maxDepth parameter.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>maxDepth</code> - parameter.</dd>
<dt><span class="strong">Returns:</span></dt><dd>maxDepth parameter.</dd></dl>
</li>
</ul>
<a name="validateMaxDepth(java.lang.String)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>validateMaxDepth</h4>
<pre>public static&nbsp;int&nbsp;validateMaxDepth(java.lang.String&nbsp;maxDepthString)</pre>
<div class="block">Validates the maxDepth parameter.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>maxDepthString</code> - parameter.</dd>
<dt><span class="strong">Returns:</span></dt><dd>maxDepth parameter.</dd></dl>
</li>
</ul>
<a name="ConstructMethodWithUserParams(java.lang.String[])">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ConstructMethodWithUserParams</h4>
<pre>public static&nbsp;<a href="../../mmj/tmff/TMFFMethod.html" title="class in mmj.tmff">TMFFMethod</a>&nbsp;ConstructMethodWithUserParams(java.lang.String[]&nbsp;param)</pre>
<div class="block">A crude TMFFMethod factory used to construct a TMFFMethod using BatchMMJ2
 RunParm values from the TMFFDefineScheme command.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>param</code> - String parameter array corresponding to the BatchMMJ2
            RunParm command TMFFDefineScheme.</dd>
<dt><span class="strong">Returns:</span></dt><dd>TMFFMethod constructed according to the user parameters.</dd></dl>
</li>
</ul>
<a name="renderFormula(mmj.tmff.TMFFStateParams, mmj.lang.ParseTree, mmj.lang.Formula)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>renderFormula</h4>
<pre>public&nbsp;int&nbsp;renderFormula(<a href="../../mmj/tmff/TMFFStateParams.html" title="class in mmj.tmff">TMFFStateParams</a>&nbsp;tmffSP,
                <a href="../../mmj/lang/ParseTree.html" title="class in mmj.lang">ParseTree</a>&nbsp;parseTree,
                <a href="../../mmj/lang/Formula.html" title="class in mmj.lang">Formula</a>&nbsp;formula)</pre>
<div class="block">Formats a formula and outputs it to a StringBuilder using the given
 ParseTree root node and initial Constant of the formula.
 <p>
 This is the main method *in* TMFFMethod for formatting a formula. I
 <p>
 Note that if the returned number of lines = -1 the formula has not been
 formatted, BUT the input StringBuilder may have been updated. To deal
 with this, it is possible to restore the StringBuilder because output is
 appended to the original input. See TMFFPreverences.renderFormula() for
 an example.
 <p>
 NOTE: TMFFUnformatted AND TMFFFlat override this method!</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>tmffSP</code> - TMFFStateParams initialized, ready for use.</dd><dd><code>parseTree</code> - for the formula to be formatted. If left null, -1 is
            returned.</dd><dd><code>formula</code> - formula to be formatted.</dd>
<dt><span class="strong">Returns:</span></dt><dd>number of lines rendered or -1 if an error was encountered and
         the formula could not be formatted.</dd></dl>
</li>
</ul>
<a name="renderSubExpr(mmj.tmff.TMFFStateParams, mmj.lang.ParseNode, int)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>renderSubExpr</h4>
<pre>protected&nbsp;int&nbsp;renderSubExpr(<a href="../../mmj/tmff/TMFFStateParams.html" title="class in mmj.tmff">TMFFStateParams</a>&nbsp;tmffSP,
                <a href="../../mmj/lang/ParseNode.html" title="class in mmj.lang">ParseNode</a>&nbsp;currNode,
                int&nbsp;leftmostColNbr)</pre>
<div class="block">Renders a sub-expression by first attempting to output on the current
 line within the maxDepth restriction; if that is not possible then it
 makes a polymorphic call to render the sub-expression using line breaks.
 This is a fairly important bit of code :)
 <p>
 Note that if later we assign TMFFSchemes at the level of individual
 Syntax Axioms, we could modify this routine to invoke the method instance
 stored in an array (4 elements) inside mmj.lang.Axiom. In preparation,
 Format Nbr is stored inside TMFFStateParams so that the array lookup can
 be done -- the array index would be set at the start of formula rendering
 and each method would invoke the 'i-th' TMFFMethod in the current node's
 stmt object (except for VarHyps). Bit of work but not too hard.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>tmffSP</code> - the TMFF state data</dd><dd><code>currNode</code> - the current node of the tree</dd><dd><code>leftmostColNbr</code> - the indent amount</dd>
<dt><span class="strong">Returns:</span></dt><dd>-1 if error else 0.</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!--   -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-all.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../mmj/tmff/TMFFFormat.html" title="class in mmj.tmff"><span class="strong">Prev Class</span></a></li>
<li><a href="../../mmj/tmff/TMFFPreferences.html" title="class in mmj.tmff"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?mmj/tmff/TMFFMethod.html" target="_top">Frames</a></li>
<li><a href="TMFFMethod.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
